let Router=require('koa-router')
let router=new Router({prefix:'/address'})
let {auth}=require('../middleware/auth.js')
let {verifyParam}=require('../middleware/address.js')
let {createAddress,getAddress,updateAddress,removeAddress}=require('../control/address.js')


router.post('/',auth,verifyParam({
    consignee:'string',
    phone:{type:"string",format:/^1\d{10}$/},
    address:"string"
}),createAddress)

router.get('/',auth,getAddress)

router.post('/update/:id',verifyParam({
    consignee:'string',
    phone:{type:"string",format:/^1\d{10}$/},
    address:"string"
}),updateAddress)

router.post('/remove/:id',auth,removeAddress)
module.exports=router